package com.hyacinth.web.ui.ligerui;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;

public class Grid {

	public static String getData(List<?> list, Class<?> c, String[] fields) {
		SimplePropertyPreFilter spp = new SimplePropertyPreFilter(c, fields);
		Map<String,List<?>> map = new HashMap<String,List<?>>();
		map.put("Rows", list);
		String str = JSON.toJSONString(map,spp,SerializerFeature.DisableCircularReferenceDetect);
		return str.replace(",\"children\":[],", ",").replace("\"children\":[],", "");
	}

}
